<?php

require 'php-sdk/src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => '176213615761250',
  'secret' => '375110a154f2a4f5b2f6e4f8f093f7be',
));

// Get User ID
$user = $facebook->getUser();

// We may or may not have this data based on whether the user is logged in.
//
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    //$user_profile = $facebook->api('/me');
	echo "you are connected";
  } catch (FacebookApiException $e) {
    //error_log($e);
    //$user = null;
  }
}
else {
	$loginUrl = $facebook->getLoginUrl();
	echo "<a href=" . $loginUrl . ">Login with Facebook</a>";
}
?>
